import time
import random


def conditioner_kt():
    class conditioner:
        __username = ""
        __price = 0.0

        # 空调品牌
        def setUsername(self, username):
            if username == "":
                print("空调品牌不能为空")
            else:
                self.__username = username

        def getUsername(self):
            return self.__username

        # 价格
        def setPrice(self, price):
            if price < 2000 or price > 200000:
                print("输入的价格不合理")
            else:
                self.__price = price

        def getPrice(self):
            return self.__price

        def conditioner_A(self):
            print(self.__username, "品牌的空调,价格为:", self.__price)

        def starting_up(self):
            print("空调开机了.....")

        def stsrting_close(self, close):
            print("空调将在,", close, "分钟后自动关闭....")

    c = conditioner()
    Username1 = input("请输入品牌名:")
    Price1 = int(input("请输入价格:"))
    c.setUsername(Username1)
    c.setPrice(Price1)

    c.conditioner_A()
    c.starting_up()
    c.stsrting_close(20)


def student_XS():
    class student:
        __username = ""
        __age = 0

        # 自己
        def setStudent_username(self, username_B):
            if username_B == "":
                print("输入的名字不符格式")
            else:
                self.__username = username_B

        def getStudent_username(self):
            return self.__username

        def setAge(self, age_B):
            if age_B < 3 or age_B > 100:
                print("没有此年龄的学生")
            else:
                self.__age = age_B

        def getAge(self):
            return self.__age

        def student_A(self):
            print("大家好,我叫", self.__username, "今年", self.__age, "岁了")

        def age_compare(self, age_A):
            if self.__age > age_A:
                num1 = self.__age - age_A
                return print("我比同桌大", num1, "岁!")
            elif self.__age < age_A:
                num2 = age_A - self.__age
                return print("我比同桌小", num2, "岁!")
            else:
                return print("我和同桌年龄一样大!")

    class student1:
        __username1 = ""
        __age1 = 0

        # 同桌
        def setStudent_username1(self, username_A):
            if username_A == "":
                print("输入的名字不符格式")
            else:
                self.__username1 = username_A

        def getStudent_username1(self):
            return self.__username1

        def setAge1(self, age_A):
            if age_A < 3 or age_A > 100:
                print("没有此年龄的学生")
            else:
                self.__age1 = age_A

        def getAge1(self):
            return self.__age1

        def student_B(self):
            print("同桌姓名为", self.__username1, "年龄为:", self.__age1)

    s = student()
    b = student1()
    username = input("请输入您姓名:")
    age = int(input("请输入您年龄:"))
    s.setStudent_username(username)  # 姓名
    s.setAge(age)  # 年龄
    username1 = input("请输入您同桌姓名:")
    age1 = int(input("请输入您同桌年龄:"))
    b.setStudent_username1(username1)
    b.setAge1(age1)
    s.student_A()
    num = (b.getAge1())
    b.student_B()
    s.age_compare(num)


def phone_DDH():
    class phone:
        username = ""  # 姓名
        sex = ""  # 性别
        age = 0  # 年龄
        surplus_money = 0  # 手机剩余话费
        brand = ""  # 手机品牌
        capacity = 0  # 手机电池容量
        screen = 0  # 屏幕大小
        duration = 0  # 手机待机时长
        integral = 0  # 手机号所拥有的积分

        def note(self, message):
            print(message)

        def hit_phone(self, number, time1):
            if number == "":
                print("输入的号码为空")
            else:
                if self.surplus_money < 1:
                    print("话费不足，请续交话费后进行操作。")
                else:
                    print("正在通话中")
                    for i in range(8):
                        print(".", end="")
                        time.sleep(1)
                    print("通话结束")
                    if time1 < 11:
                        self.surplus_money = self.surplus_money - time1 * 1
                        self.integral = time1 * 15
                        print("剩余的话费:", self.surplus_money, "所得积分:", self.integral)
                    elif 10 < time1 <= 20:
                        self.surplus_money = self.surplus_money - time1 * 0.8
                        self.integral = time1 * 39
                        print("剩余的话费:", self.surplus_money, "所得积分:", self.integral)
                    else:
                        self.surplus_money = self.surplus_money - time1 * 0.65
                        self.integral = time1 * 48
                        print("剩余的话费:", self.surplus_money, "所得积分:", self.integral)

        def integral_dh(self, dh):
            while True:
                if dh == "是":
                    self.surplus_money = self.surplus_money + self.integral / 30
                    self.surplus_money = int(self.surplus_money)
                    print("剩余话费为:", self.surplus_money)
                    break
                elif dh == "否":
                    break

    time1 = random.randint(1, 30)
    p = phone()
    p.username = "张三"
    p.sex = "女"
    p.age = 20
    p.surplus_money = 30
    p.brand = "诺基亚x200"
    p.capacity = 500000
    p.screen = 12.89
    p.duration = 50
    p.integral = 0

    message1 = input("请输入信息:")
    p.note(message1)
    phone = input("请输入电话号码:")
    p.hit_phone(phone, time1)
    num = input("是否将积分兑换成话费,是/否:")
    p.integral_dh(num)


def programming():
    # 学生类
    class student_xue:
        student_number = 0  # 学号
        __username = ""  # 姓名
        age = 0  # 年龄
        sex = ""  # 性别
        height = 0  # 身高
        weight = 0  # 体重
        grade = 0  # 成绩
        address = ""  # 家庭住址
        phone = 0  # 电话号码

        def setUsername(self, username):
            if username == "":
                print("输入的姓名不符合")
            else:
                self.__username = username

        def getUsername(self):
            return self.__username

        def xue_day(self, time):
            print(self.__username, "今天写语文作业,用了", time, "小时")

        def xue_YX(self, game):
            print(self.__username, "今天写了java语言，总共写了", game, "行")

        def xue_BC(self, *args):
            num = 0
            print("args=", args)
            for i in args:
                num = num + i
            return print("总和为:", num)

        # 车类

    s = student_xue()
    s.xue2 = "小明"
    s.xue_day(3)
    s.xue_YX(10000)
    s.xue_BC(33, 22, 44, 44, 123, 23, 14)

    class vehicle:
        __model = ""  # 车型号
        __number = 0  # 车轮的数量
        colour = ""  # 车身颜色
        weight = 0  # 车身重量
        stockpile = 0  # 油量储存大小

        def setModel(self, model):
            if model == "":
                print("车型号不能为空")
            else:
                self.__model = model

        def getModel(self):
            return self.__model

        def setNumber(self, number):
            if number < 2:
                print("轮子太少")
            else:
                self.__number = number

        def getNumber(self):
            return self.__number

        def Ferrari(self, num, num2):
            print(num, self.__model, "车轮的数量为:", self.__number, "外观颜色混合搭配，主要以"
                  , self.colour, "为主", "车身重量为:", self.weight, "KG,全身为碳纤维打造,油箱容量高达:", self.stockpile, "升", num2)

        def BMW(self, num, num2):
            print(num, self.__model, "车轮的数量为:", self.__number, "全身为"
                  , self.colour, "为主", "车身重量为:", self.weight, "KG,全身为碳纤维打造,油箱容量高达:", self.stockpile, "升", num2)

    # 法拉利参数
    A = vehicle()
    A.setModel("法拉利S18")
    A.setNumber(4)
    A.colour = "红色"
    A.weight = 2000
    A.stockpile = 100
    A.Ferrari("让我们有请最新跑车", "专为赛车场定制，百公里加速2.5秒")
    # 奥迪参数
    B = vehicle()
    B.setModel("奥迪RS7")
    B.setNumber(4)
    B.colour = "黑色"
    B.weight = 5000
    B.stockpile = 100
    B.Ferrari("有请", "主要以代步为主，性能很强")

    # 笔记本类
    class notebook:
        model = ""  # 笔记本型号
        time = 0  # 待机时间
        color = ""  # 颜色
        weight = 0  # 重量
        cpu = ""  # cpu
        memory = 0  # 内存
        hard = 0  # 硬盘

        def notebook_game(self, name, game):
            print(name, "的电脑型号为:", self.model, "外观颜色为", self.color, "搭载着", self.cpu, "内存:", "G", self.memory, "玩着",
                  game)

        def notebook_work(self, name, work):
            print(name, "的电脑型号为:", self.model, "外观颜色为", self.color, "搭载着", self.cpu, work)

    s = notebook()
    s.model = "暗夜精灵七"
    s.color = "墨绿黑"
    s.cpu = "AMD R8 -5800"
    s.memory = 32
    s.notebook_game("小明", "贪吃蛇")
    s.notebook_work("小兰", "写着python代码")

    # 猴子类

    class monkey:
        category = ""
        sex = ""
        color = ""
        weight = 0

        def build(self, timber):
            print("一只外观颜色为", self.color, "性别为", self.sex, "的", self.category, "拿着一块", timber, "进行钻木取火")

        def build_A(self, A, B, C, D, E):
            print(self.category, "通过火焰学会了:", A, B, C, D, E)

    s = monkey()
    s.category = "金丝猴"
    s.sex = "雌性"
    s.color = "蓝色"
    s.build("木头")
    s.build_A("韩式烤肉", "关东煮", "兰州拉面", "铁锅炖大鹅", "煎牛排")


while True:
    print("1、空调 2、学生 3、打电话业务逻辑 4、需求编程 5、退出系统")
    XZ = int(input("请选择:"))
    if XZ == 1:
        conditioner_kt()
    elif XZ == 2:
        student_XS()
    elif XZ == 3:
        phone_DDH()
    elif XZ == 4:
        programming()
    elif XZ == 5:
        break
